package com.woniuxy.yoga.course.client;

import com.woniuxy.yoga.commons.core.model.Result;
import com.woniuxy.yoga.course.client.dto.course.CourseTypeDTO;
import com.woniuxy.yoga.course.model.dto.alone.AloneReservationDTO;
import com.woniuxy.yoga.course.model.dto.ordinary.OrdinaryCourseByIdDTO;
import com.woniuxy.yoga.course.model.dto.ordinary.OrdinaryCourseDTO;
import com.woniuxy.yoga.course.model.dto.team.TeamCourseDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * 课程的服务访问类
 */
@FeignClient(name = "course-service",path = "/course")
public interface CourseClient {

    /**
     * 根据课程类型ID查询课程类型
     * @param courseTypeId
     * @return
     */
    @GetMapping("/courseType/getById/{courseTypeId}")
    public Result<CourseTypeDTO> getCourseTypeById(@PathVariable("courseTypeId") Integer courseTypeId);

    /**
     * 教练ID查询普通课程信息
     * @param
     * @return
     */
    @PostMapping("/ordinaryCourse/getByCoachId")
    public Result<List<OrdinaryCourseDTO>> getOrdinaryByCoachId(@RequestBody List<Integer> ids);

    /**
     * 根据私教预约ID查询私教预约信息
     * @param reservationId
     * @return
     */
    @GetMapping("/aloneReservation/getById/{reservationId}")
    public Result<AloneReservationDTO> getAloneReservationById(@PathVariable("reservationId") Integer reservationId);

    /**
     * 教练ID查询团队课程
     * @param ids
     * @return
     */
    @PostMapping("/teamCourse/getByCoachId")
    public Result<List<TeamCourseDTO>> getTeamCourseByCoachId(@RequestBody List<Integer> ids);

    /**
     * 教室ID查询普通课程
     * @param classroomId
     * @return
     */
    @GetMapping("/ordinaryCourse/getByClassroomId/{classroomId}")
    public Result<List<OrdinaryCourseDTO>> getOrdinaryCourseByClassroomId(@PathVariable("classroomId") Integer classroomId);

    /**
     * 根据普通课程ID查询
     * @param courseId
     * @return
     */
    @GetMapping("/ordinaryCourse/getById/{courseId}")
    public Result<OrdinaryCourseByIdDTO> getOrdinaryCourseById(@PathVariable("courseId") Integer courseId);

    /**
     * 普通课程当前人数加一
     * @param courseId
     * @return
     */
    @GetMapping("/ordinaryCourse/increaseCurrentCount/{courseId}")
    public Result<?> OrdinaryCourseIncreaseCurrentCount(@PathVariable("courseId") Integer courseId);

    /**
     * 普通课程当前预约人数减一
     * @param courseId
     * @return
     */
    @GetMapping("/ordinaryCourse/reduceCurrentCount/{courseId}")
    public Result<?> OrdinaryCourseReduceCurrentCount(@PathVariable("courseId") Integer courseId);

    /**
     * 私教预约次数减一
     * @param reservationId
     * @return
     */
    @GetMapping("/aloneReservation/reduceAloneReservationCount/{reservationId}")
    public Result<?> reduceAloneReservationCount(@PathVariable("reservationId") Integer reservationId);
}
